//
//  LogisticsInfoCell.swift
//  SlaughterClient
//
//  Created by 邱仙凯 on 2021/6/11.
//  Copyright © 2021 zwb. All rights reserved.
//

import UIKit

class ZyaLogisticsInfoCell: UITableViewCell {
    
    private var lab1: UILabel!
    private var lab2: UILabel!
    lazy var bg:UIView = {
        let v = UIView()
        v.backgroundColor = .white
        return v
    }()
    lazy var line1:UIView = {
       let v = UIView()
        v.backgroundColor = UIColor(kshex: "#aaaaaa")
        return v
    }()
    lazy var line2:UIView = {
       let v = UIView()
        v.backgroundColor = UIColor(kshex: "#aaaaaa")
        return v
    }()
    
    override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
        super.init(style: style, reuseIdentifier: reuseIdentifier)
        self.contentView.backgroundColor = UIColor(kshex: "#f2f2f2")
        self.contentView.addSubview(bg)
        
        lab1 = UILabel()
        lab1.numberOfLines = 2
        lab1.textAlignment = .center
        lab1.font = UIFont.systemFont(ofSize: 14)
        lab1.textColor = .darkGray

        bg.addSubview(lab1)
        lab2 = UILabel()
        lab2.numberOfLines = 0
        lab2.font = UIFont.systemFont(ofSize: 14)
        lab2.textColor = .darkGray
        bg.addSubview(lab2)
        
        bg.addSubview(line1)
        bg.addSubview(line2)
        self.makeConstrainsts()
        
    }
  
    func makeConstrainsts() {
        
        bg.snp.makeConstraints { (make) in
            make.left.equalTo(self.contentView).offset(5)
            make.right.equalTo(self.contentView).offset(-5)
            make.top.equalTo(self.contentView)
            make.bottom.equalTo(self.contentView)
        }
        
        lab1.snp.makeConstraints { (make) in
            make.left.equalTo(bg).offset(8)
            make.width.equalTo(100)
            make.centerY.equalTo(lab2)
        }

        lab2.snp.makeConstraints { (make) in
            make.left.equalTo(bg).offset(100)
            make.top.equalTo(bg).offset(6)
            make.right.equalTo(bg).offset(-6)
            make.bottom.equalTo(bg).offset(-30)
        }
        line1.snp.makeConstraints { (make) in
            make.top.equalTo(bg)
            make.centerX.equalTo(lab1)
            make.width.equalTo(1)
            make.bottom.equalTo(lab1.snp.top).offset(-2)
        }
        line2.snp.makeConstraints { (make) in
            make.top.equalTo(lab1.snp.bottom).offset(3)
            make.centerX.equalTo(lab1)
            make.width.equalTo(1)
            make.bottom.equalTo(bg)
        }
    }
    
    
    
    required init?(coder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    
    var one = LoInfoModel(JSON:["":""])! {
        didSet {
//                    bg.setMutiBorderRoundingCorners(corner: [.topLeft,.topRight], number: 12)

            lab1.text = one.time
            lab2.text = one.status
        }
    }
    
    
    override func setSelected(_ selected: Bool, animated: Bool) {
        super.setSelected(selected, animated: animated)
        
        // Configure the view for the selected state
    }
    
}
